package com.book.controller;


import com.book.pojo.MonthlyPass;
import com.book.result.Result;
import com.book.service.MonthlyPassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fk
 * @since 2023-10-14 09:16:53
 */
@RestController
@RequestMapping("/monthly-pass")
public class MonthlyPassController {

    @Autowired
    private MonthlyPassService monthlyPassService;

    //读者可以对一本书反复进行投月票 月票榜实时更新
    @PostMapping("addMonthlyPass")
    public Result addMonthlyPass(MonthlyPass monthlyPass){
        monthlyPassService.addMonthlyPass(monthlyPass);
        return Result.OK();
    }

    //月票榜
    @GetMapping("monthlyRanking")
    public List<MonthlyPass> monthlyRanking(){
       return monthlyPassService.monthlyRanking();

    }
}
